func reconstructQueue(people [][]int) [][]int {
    res := make([][]int, 0)
    sort.Slice(people, func (i , j int) bool {
        if people[i][0] == people[j][0] {
            return people[i][1] < people[j][1]
        }
        return people[i][0] > people[j][0]
    })
    for _, p := range people {
        res = append(res, p)
        copy(res[p[1]+1:], res[p[1]:])
        res[p[1]] = p

    }
    return res
}